package com.mj.dreamandroid.util;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.util.Log;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Created by Administrator on 2017/7/1.
 */
@RunWith(AndroidJUnit4.class)
public class StockSharedPreferencesTest {
   private Context appContext = InstrumentationRegistry.getTargetContext();
    @Before
    public void setUp() throws Exception{
        Log.d("StockSharedPreferencesTest","setUp");
        StockSharedPreferences.clearData(appContext);
    }

    @Test
    public void savePaintStyleFill() throws Exception {
        Log.d("StockSharedPreferencesTest","savePaintStyleFill");
        StockSharedPreferences.savePaintStyleFill(appContext,true);
        assertEquals(true,StockSharedPreferences.isPaintStyleFill(appContext));
    }

    @Test
    public void isPaintStyleFill() throws Exception {
        Log.d("StockSharedPreferencesTest","isPaintStyleFill");
        assertEquals(false,StockSharedPreferences.isPaintStyleFill(appContext));
    }

    @Test
    public void saveSelectSpeed() throws Exception {
        StockSharedPreferences.saveSelectSpeed(appContext,5);
        assertEquals(5,StockSharedPreferences.getSelectSpeed(appContext));
    }

    @Test
    public void getSelectSpeed() throws Exception {
        assertEquals(3,StockSharedPreferences.getSelectSpeed(appContext));
    }

    @Test
    public void clearData() throws Exception {

    }

}